﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_IPORT.Master" CodeBehind="Truck_Licence_Master.aspx.vb" Inherits="I_PORT.Truck_Licence_Master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" language="javascript">
    var _source;
    // keep track of the popup div
    var _popup;

    function showConfirm(customerid) {
        this._source = customerid;
        this._popup = $find('ModalPopupExtender3');
        this._popup.show();
    }
    function okClick() {
        //  find the confirm ModalPopup and hide it
        this._popup.hide();

        __doPostBack(this._source.name, '');

    }

    function cancelClick() {
        //  find the confirm ModalPopup and hide it
        this._popup.hide();
    }
</script>

    <asp:UpdatePanel ID="update1" runat="server">
    <ContentTemplate>
        <table width="100%" border="0" cellpadding="2" cellspacing="0">
            <asp:Panel ID="tableDataPanel" runat="server">
           
        <tr>
             <td style="width:20%;" align="right">Licence&nbsp;</td>
             <td align="left"><asp:TextBox ID="txtLicenceSearch" runat="server"></asp:TextBox>
             <asp:Button ID="btnSearch" runat="server" Text="ค้นหา" CssClass="ButtonStyle" />
             </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <asp:UpdatePanel ID="dataPanel" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="licenceGrid" runat="server" SkinID="gridblue" AutoGenerateColumns="false" 
                        DataKeyNames="TruckLicenceID,TruckLicence,Weight,Pieces,TruckTypeID,TailerLicence">
                            <Columns>
                                <asp:BoundField DataField="TruckLicence" HeaderText="ทะเบียนรถ" />
                                <asp:BoundField DataField="TailerLicence" HeaderText="ทะเบียนหางรถ" />
                                <asp:BoundField DataField="TruckType" HeaderText="Truck Type" />
                                <asp:BoundField DataField="Weight" HeaderText="Weight" />
                                <asp:BoundField DataField="Pieces" HeaderText="Pieces" />
                                <asp:TemplateField HeaderText="แก้ไข" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                                   <ItemTemplate>
                                         <asp:ImageButton ID="imgedit" CommandName="Edit"   runat="server" ImageUrl="~/Image/edit-24.gif" />
                                   </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                                   <ItemTemplate>
                                         <asp:ImageButton ID="imgdelete" CommandName="Delete"  OnClientClick="showConfirm(this); return false;"  runat="server" ImageUrl="~/Image/cancel-24.gif" />
                                   </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                <tr class="gvHeaderRow" style="color:White">
                                    <th>Licence</th>
                                    <th>Weight</th>
                                    <th>Pieces</th>
                                    <th>แก้ไข</th>
                                    <th>ลบ</th>
                                </tr>
                                <tr>
                                    <td colspan="5" style="text-align:center; color:Red; background-color:#C0E9AD; font-size:14px;">-= ไม่พบข้อมูล =-</td>
                                </tr>
                            </EmptyDataTemplate>
                            <PagerTemplate>
                                <table>
                                    <tr>
                                        <td>
                                            <asp:ImageButton ID="ImgFirst" runat="server" Height="22px" ImageUrl="../Image/arrow-first.gif"
                                                OnCommand="Paginate" CommandArgument="First" CommandName="Page" />
                                        </td>
                                        <td>
                                            <asp:ImageButton ID="ImgBack" runat="server" Height="22px" ImageUrl="../Image/arrow-back.gif"
                                                OnCommand="Paginate" CommandArgument="Prev" CommandName="Page" />
                                        </td>
                                        <td valign="top">
                                            Page
                                            <asp:DropDownList ID="ddlPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPage_SelectedIndexChanged">
                                            </asp:DropDownList>
                                            of
                                            <asp:Label ID="lbPageCount" runat="server" Text="Label"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:ImageButton ID="ImgNext" runat="server" Height="22px" ImageUrl="../Image/arrow-next.gif"
                                                OnCommand="Paginate" CommandArgument="Next" CommandName="Page" />
                                        </td>
                                        <td>
                                            <asp:ImageButton ID="ImgEnd" runat="server" Height="22px" ImageUrl="../Image/arrow-end.gif"
                                                OnCommand="Paginate" CommandArgument="Last" CommandName="Page" />
                                        </td>
                                    </tr>
                                </table>
                             </PagerTemplate>
                        </asp:GridView>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
           <td style="width:20%;" align="right"></td>
           <td align="left"><asp:Button ID="btnAddLicence" runat="server" Text="New Truck Licence"  CssClass="ButtonStyle" style="width:150px" /></td>
        </tr>
         </asp:Panel>
        <asp:Panel ID="formPanel" runat="server" Visible="false">
            <tr>
                <td colspan="2">
                    <table width="100%" border="0" cellpadding="2" cellspacing="0">
                   <tr>
                     <td style="width:20%;" align="right"><asp:Label ID="lbMark" runat="server" Text="*" ForeColor="Red" ></asp:Label><asp:Label ID="Label1" runat="server" SkinID="lbtxt" Text="ทะเบียนหัวรถ :"></asp:Label>&nbsp;</td>
                     <td align="left">
                         <asp:TextBox ID="txtLicence" runat="server" Width="200px" MaxLength="200"></asp:TextBox>
                     </td>
                   </tr>
                    <tr>
                     <td style="width:20%;" align="right"><asp:Label ID="Label5" runat="server" Text="*" ForeColor="Red" ></asp:Label><asp:Label ID="Label6" runat="server" SkinID="lbtxt" Text="ทะเบียนหางรถ :"></asp:Label>&nbsp;</td>
                     <td align="left">
                         <asp:TextBox ID="txtTailerLicence" runat="server" Width="200px" MaxLength="200"></asp:TextBox>
                     </td>
                   </tr>
                   <tr>
                    <td align="right"><span style="color:Red">*</span><asp:Label ID="Label2" runat="server" SkinID="lbtxt" Text="Weight :"></asp:Label></td>
                    <td>
                        <asp:TextBox ID="txtWeight" runat="server" Width="200px" MaxLength="200"></asp:TextBox></td>
                   </tr>
                   <tr>
                    <td align="right"><span style="color:Red">*</span><asp:Label ID="Label4" runat="server" SkinID="lbtxt" Text="Truck Type :"></asp:Label></td>
                    <td>
                        <asp:DropDownList ID="ddlTruckType" runat="server"></asp:DropDownList>
                   </td>
                   </tr>
                   <tr>
                    <td align="right"><span style="color:Red">*</span><asp:Label ID="Label3" runat="server" SkinID="lbtxt" Text="Pieces :"></asp:Label></td>
                    <td>
                        <asp:TextBox ID="txtPieces" runat="server" Width="200px" MaxLength="200"></asp:TextBox></td>
                   </tr>
                    <tr>
                     <td style="width:20%;" align="right">&nbsp;</td>
                     <td align="left">
                           <asp:Button ID="btnSave" runat="server" Text="บันทึก" CssClass="ButtonStyle" />
                           <asp:Button ID="btnCancel" runat="server" Text="ยกเลิก" CssClass="ButtonStyle" />
                     </td>
                   </tr>
                   </table>
                </td>
            </tr>
        </asp:Panel>
     </table>
        <asp:Label ID="msgLabel" runat="server"></asp:Label>
    <asp:Panel ID="PanelConfirm" runat="server" style="display:none;">
       <Confirm:Confirm1 ID="ConfirmDelete" runat="server" ></Confirm:Confirm1>
    </asp:Panel>
    </ContentTemplate>
    </asp:UpdatePanel>
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>
